﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GestionePolveri2
{
    public partial class TotalViewerDialog : Form
    {
        private object m_totalsContainer = null;

        public object TotalsContainer
        {
            get { return m_totalsContainer; }
            set 
            {
                m_totalsContainer = value;

                this.propertyGridEx1.SelectedObject = m_totalsContainer;
                this.propertyGridEx1.CustomSort(FrameworkLib.Utilities.CustomTypeDescriptor.CustomSortOrder.AscendingById);
            }
        }

        public TotalViewerDialog()
        {
            InitializeComponent();
            this.FormClosing += new FormClosingEventHandler(TotalViewerDialog_FormClosing);
        }

        void TotalViewerDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.propertyGridEx1.SelectedObject = null;
            m_totalsContainer = null;
        }

        public void ShowTotalElement(string elementName, bool visible)
        {
            this.propertyGridEx1.SetVisible(elementName, visible);
        }
    }
}
